open(BUFF,"input_file1")or die "no file found\n";
#$line=<BUFF>;
#./backup/s_0917401553.chr
#$sys = "vcf-concat A.vcf.gz B.vcf.gz C.vcf.gz | bgzip -c > ./final_vcf/ ";
@chr = ('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','X','Y','M');
while($line=<BUFF>)
{
	$sys = "";
	chomp($line);
	if($line !~   m/^#/)
	{
		$line =~ s/^#//g;
		@arr = split("\t",$line);
		print "dealing with $. $arr[1]\n";
		for($i=0;$i<@chr;$i++)
		{
			#print "$i $chr[$i]\n";
			$names = "$arr[1].chr$chr[$i].snvs.raw.snvmix.vcf.gz";
			$file = "/data2/bsi/RandD/bora/Exome_2samples/backup/$arr[1].chr/".$names;
			#print "$file\n";
			if (-e $file )
			{
				#print "$file\n";
				print "dealing with $. $arr[1] $i $names[$i]\n";
				$sys = "$sys $file";
			}	
			else
			{
				die "no file found  $file\n";
			}	
		}
		$sys = "/data2/bsi/RandD/bora/Exome_2samples/vcf-concat $sys | bgzip -c > /data2/bsi/RandD/bora/Exome_2samples/final_vcf/$arr[1].vcf.gz";
		print "$sys\n";
		system($sys);
		system("tabix -p vcf -f /data2/bsi/RandD/bora/Exome_2samples/final_vcf/$arr[1].vcf.gz");	
	}
}
